package com.lxb.myforum.repository

import org.springframework.data.jpa.repository.JpaSpecificationExecutor
import org.springframework.data.jpa.repository.Query
import org.springframework.data.repository.PagingAndSortingRepository
import org.springframework.stereotype.Repository

import com.lxb.myforum.pojo.Resource

/**
 *
 * @author lxb
 */
@Repository
interface ResourceRepository : PagingAndSortingRepository<Resource, Long>, JpaSpecificationExecutor<Resource> {

    @Query(value = "select * from `t_resource` a left join `t_authority_resource` b on a.id = b.`resource_id` where b.authority_id != ?1 || ISNULL(b.authority_id);", nativeQuery = true)
    fun findNotAuthRes(authId: Long): List<Resource>
}
